package com.ext.aic.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.ext.aic.R;
import com.ext.aic.beans.TaskItem;
import com.ext.aic.databinding.CurrentTaskItemViewBinding;
import com.ext.aic.holder.TaskViewHolder;

import java.util.List;

import lombok.Setter;

public class TaskListAdapter extends RecyclerView.Adapter<TaskViewHolder> {

    @Setter
    private List<TaskItem> items;

    @Override
    public TaskViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.current_task_item_view, parent, false);
        return new TaskViewHolder(CurrentTaskItemViewBinding.bind(view));
    }

    @Override
    public void onBindViewHolder(TaskViewHolder holder, int position) {
        TaskItem taskItem = items.get(position);
        holder.taskTypeTv.setText(taskItem.getTitle());
        holder.taskDescribeTv.setText(taskItem.getDescription());

        holder.currentTaskRl.setOnClickListener(v -> {
        });
    }

    @Override
    public int getItemCount() {
        return items.size();
    }
}
